Generating comprehensive symbol tables for source code files

ABSTRACT

A computer program product includes instructions to identify a primary symbol table associated with a primary source code file and identify a secondary symbol table associated with a secondary source code file. The computer program product includes instructions to receive a source code association indication. The source code association indication includes at least one association relationship between the primary source code file and the secondary source code file. The computer program product includes instructions to create a comprehensive symbol table. The comprehensive symbol table comprises contents of the primary symbol table and contents of the secondary symbol table. A corresponding computer-implemented method and computer system are also disclosed.

BACKGROUND

The present invention relates generally to the field of code-editinguser interfaces, and more particularly to generating symbol tables forsource code files.

Symbol tables generated based on one or more source code files can serveto enhance the quality and convenience of user experience incode-editing user interfaces. Users of code-editing user interfacescontinue to face difficulties with some inadequate features of thosesoftware platforms that result from inefficient techniques of generatingsymbol tables used by those software platforms.

SUMMARY

A computer program product includes instructions to identify a primarysymbol table associated with a primary PL/I source code file andidentify a secondary symbol table associated with a secondary PL/Isource code file. The computer program product further includesinstructions to receive a source code association indication. The sourcecode association indication includes at least one associationrelationship between the PL/I source code file and the secondary sourcecode file. The computer program product further includes instructions tocreate a comprehensive symbol table. The comprehensive symbol tablecomprises contents of the primary symbol table and contents of thesecondary symbol table. The computer program product further includesinstructions to retrieve the comprehensive symbol table and retrieve oneor more user source code textual inputs from one or more users. The oneor more user source code textual inputs are associated with the primaryPL/I source code file. The computer program product further includesinstructions to determine zero or more auto-completion suggestions basedon the one or more user source code textual inputs and the comprehensivesymbol table. The computer program product further includes instructionsto display the zero or more auto-completion suggestions to the one ormore users in the context of at least one instance of the primary PL/Isource code file. A corresponding computer-implemented method andcomputer system are also disclosed.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of one embodiment of a computer systemenvironment suitable for operation of a comprehensive symbol tablegeneration program, in accordance with at least one embodiment of thepresent invention.

FIG. 2 is a flowchart diagram of a comprehensive symbol table generationprogram, in accordance with at least one embodiment of the presentinvention.

FIG. 3 is an operational example of a comprehensive symbol tablegeneration program, in accordance with at least one embodiment of thepresent invention.

FIGS. 4A, 4B, and 4C are an operational examples of symbol tables, inaccordance with at least one embodiment of the present invention.

FIG. 5 is a block diagram of a computing apparatus suitable forexecuting a comprehensive symbol table generation program, in accordancewith at least one embodiment of the present invention.

DETAILED DESCRIPTION

FIG. 1 is a block diagram of one embodiment of a computer systemenvironment suitable for operation of a comprehensive symbol tablegeneration program 110, in accordance with at least one embodiment ofthe present invention. In the computer system depicted in FIG. 1, an IDEsymbol table generator 120 is a component of a code-editing userinterface (also known as an integrated development environment, or anIDE) responsible for generating one or more symbol tables based on oneor more source code files. The IDE symbol table generator 120 uses theprimary source code file 151 to generate a primary symbol table 131, anda secondary source code file 152 to generate a secondary symbol table132.

In some embodiments, the IDE symbol table generator 120 periodicallymonitors (e.g. loads and parses) the contents of one or more source codefiles (such as the primary source code file 151 and the secondary sourcecode file 152) to generate one or more symbol tables (such as theprimary symbol table 131 and the secondary symbol table 132). In atleast some embodiments, a symbol table generated based on a source codefile comprises zero or more source code symbols (e.g. variable names,function/subroutine/method names, data types, etc.) used, declared,defined, initialized, and/or assigned to in the source code file.

In the computing environment depicted in FIG. 1, the comprehensivesymbol table generation program 110 uses the primary symbol table 131,the secondary symbol table 132, and information 123 about one or moreassociation relationships between the primary source code file 151 andthe secondary source code file 152 (i.e. the “source code associationinformation” 123) to create a comprehensive symbol table 140. In atleast some embodiments, the comprehensive symbol table comprises anysource code symbols in the primary source code file 151 and any sourcecode symbols in the secondary source code file 152.

FIG. 2 is a flow-chart diagram of a comprehensive symbol tablegeneration program, in accordance with at least one embodiment of thepresent invention. At step 200, the program identifies a primary symboltable associated with a primary source code file. At step 201, theprogram identifies a secondary symbol table associated with a secondarysource code file. At step 202, the program receives a source codeassociation indication, where the source code association indicationdenotes at least one association relationship between the primary sourcecode file and the secondary source code file. At step 203, the programcreates a comprehensive symbol table comprising contents of the primarysymbol table and contents of the secondary symbol table.

In some embodiments, the primary source code file is a header sourcecode file. A header source code file is any source code file whosecontents will, during regular execution of a source code program, be inwhole or in part inserted into one or more other files. In at least someembodiments, the insertion of the header source code file contents intoone or more other files is requested by the programmer using one or moreinclude indications, such as one or more include directives (e.g. the#include directive in C and C++, the COPY directive in COBOL, the %include directive in PL/I, the <!--#include . . . --> directive in HTMLSSI, and the <%@ include . . . %> directive in JSP). In someembodiments, the header source code file comprises source codedefinitions and/or source code declarations of one or morefunctions/subroutines/methods and/or one or more data variables(including one or more class instances and/or objects).

In some embodiments, the comprehensive symbol generation programreceives one or more user source code textual inputs from one or moreusers, where the one or more user source code textual inputs areassociated with the header source code file. The program furtherdetermines zero or more auto-completion suggestions based on the one ormore user source code textual inputs and the comprehensive symbol table.In some of those embodiments, the program further displays the zero ormore auto-completion suggestions to the one or more users in the contextof at least one instance of the header source code file (e.g. in atleast one page in which the header source code file is being edited, forinstance using an IDE). In at least some of those embodiments, theprogram uses the comprehensive symbol table to generate auto-completionsuggestions that facilitate the creation and/or editing of the headersource code file. In some embodiments, determining the zero or moreauto-completion suggestions comprises retrieving the comprehensivesymbol table. In some embodiments, the program displays the zero or moreauto-completion suggestions to the one or more users in the context ofthe primary source code file. In some embodiments, the program displaysthe zero or more auto-completion suggestions to the one or more users inthe context of the header source code file. In at least someembodiments, retrieving a symbol table comprises querying the symboltable.

FIG. 3 is an operational example of a comprehensive symbol tablegeneration program, in accordance with at least one embodiment of thepresent invention. In the embodiment depicted in FIG. 3, the PL/I sourcecode file PROGRAM.PLI 300 and the PL/I source code file HEADER.INC 301are associated through at least one association relationship, and theindication of that association (e.g. caused to be made by theprogrammer) has been received by the program. The source code filePROGRAM.PLI 300 declares and initializes the symbol S1, which is anarray of characters (i.e. functionally, a string) of size 5, on line 3;and declares and initializes the symbol S2, which is also an array ofcharacters of size 5, on line 4. The source code file HEADER.INC 301declares the symbol S, which is an array of characters of size 10, online 2.

In the embodiment depicted in FIG. 3, when the programmer uses the IIoperator, which in PL/I can take a character array on its right-handside, the comprehensive symbol table generation program determines threeauto-completion suggestions 350 for the entry on the right hand side ofthat operator: the S1 361 and S2 362 symbols (both denoting characterarray variables) from the associated source code file PROGRAM.PLI 300;and the S symbol 360 (denoting a character array variable) from thesource code file HEADER.INC 301 itself.

FIGS. 4A, 4B, and 4C depict operational examples of symbol tables, inaccordance with at least one embodiment of the present invention. Thesymbol table depicted in FIG. 4A is associated with the source code fileHEADER.INC 301, and comprises the symbol S 360. The symbol table in FIG.4B is associated with the source code file PROGRAM.PLI 300 and comprisesthe symbol S1 361 and symbol S2 362.

The symbol table in FIG. 4C is a comprehensive symbol table produced bythe symbol table generation program. The comprehensive symbol table inFIG. 4C comprises the contents (e.g. symbols) of both the symbol tablein FIG. 4A (i.e. the symbol S 360) and the symbol table in FIG. 4B (i.e.the symbol S1 361 and the symbol S2 362). In some embodiments, thecomprehensive symbol table generation program uses a comprehensivesymbol table (such as the symbol table in FIG. 4C) to generate zero ormore auto-completion suggestions in the context of a header source codefile (such as the source code file HEADER.INC 301) based on one or moresource code textual inputs from one or more users (such as the insertionof the II operator in the PL/I source code file HEADER.INC 301).

The comprehensive symbol table generation program identifies a primarysymbol table at step 200 and a secondary symbol table at step 201. Insome embodiments, the program identifies a primary symbol table and/or asecondary symbol table based on one or more pieces of informationobtained directly or indirectly from one or more computer (hardware orsoftware) components, and/or one or more pieces of information obtaineddirectly or indirectly from one or more inputs from one or more users.In some embodiments, the program identifies a primary symbol tableand/or a secondary symbol table by identifying a primary source codefile and/or a secondary source code file. In some embodiments, theprogram constructs a primary symbol table and/or a secondary symboltable. In some embodiments, the program loads the primary source codefile and parses the primary source code file (e.g. to create a primarysymbol table). In some of those embodiments, the program further loadsthe secondary source code file and parses the secondary source code file(e.g. to create a secondary symbol table).

The comprehensive symbol table generation program receives a source codeassociation indication at step 202. In some embodiments, the programreceives a source code association indication by receiving one or morepieces of information obtained directly or indirectly from one or morecomputer (hardware or software) components, and/or one or more pieces ofinformation obtained directly or indirectly from one or more inputs fromone or more users. In some embodiments, the program receives a sourcecode association indication by accessing one or more locations in acomputer readable storage media. The possible forms of computer readablestorage media comprise persistent storage components (such as the harddisks), main memory components, cache components, registers and otherstorage media components in the processing circuit, online storagecomponents, and offline bulk storage components.

In some embodiments, the source code association indication comprisesone or more instructions to least one application programming interface.In some embodiments, the source code association indication comprisesone or more instructions to at least one user interface managementsoftware. In some embodiments, the source code association indication iscaused to be made by one or more actions performed on and/or issued to agraphical user interface software platform. In some embodiments, thesource code association indication may be based on one or more rulesand/or conventions of one or more programming languages and/or one ormore coding platforms. In some embodiments, the source code associationindication comprises one or more input instructions selected from thegroup consisting of: (i) one or more instructions to least oneapplication programming interface; and (ii) one or more instructions toat least one user interface management software. In some embodiments,the source code association indication may comprise a combination of twoor more of the aforementioned information and/or user actions.

The source code association indication denotes at least one associationrelationship between a primary source code file and a secondary sourcecode file. In some embodiments, an association relationship is anyrelationship that in whole or in part creates at least one point ofintersection between one or more of the namespaces of one source codefile and one or more of the namespaces of another source code file; orany relationship that in whole or in part causes at least one sourcecode symbol to be potentially referenceable in at least two source codefiles. In some embodiments, an association relationship is anyrelationship that in whole or in part causes at least one source codesymbol to be shared between at least one of the one or more symboltables of one source code file and at least one of the one or moresymbol tables of another source code file.

The comprehensive symbol table generation program creates acomprehensive symbol table at step 203. In some embodiments, the programgenerates and/or compiles the code for creating the comprehensive symboltable. In some embodiments, the program receives pre-generated and/orpre-compiled code for creating a comprehensive symbol table obtaineddirectly or indirectly from one or more computer (hardware or software)components. In some embodiments, the program creates a comprehensivesymbol table by receiving one or more pieces of information obtaineddirectly or indirectly from one or more computer (hardware or software)components, and/or one or more pieces of information obtained directlyor indirectly from one or more inputs from one or more users. In someembodiments, the program creates a comprehensive symbol table bycreating a comprehensive source code file comprising the primary sourcecode file and the secondary source code file and creating a symbol tablefor the comprehensive source code file (e.g. by loading and parsing thecomprehensive source code file). In at least some embodiments, creatinga symbol table for one or more source code files comprises determiningzero or more source code symbols (and/or the syntactic and/or semanticproperties of those symbols) based on the one or more source code files.

Generating comprehensive symbol tables based on customized, user-issuedassociation indications in addition to static rules of source codeassociation (e.g. rules based on one or more rules and/or conventions ofone or more programming languages and/or one or more coding platforms)allow for more intelligent creation of comprehensive symbol tables thatcan facilitate programming and/or software development practice. Inaddition, generating comprehensive symbol tables based on customized,user-issued association indications introduces notions of dynamicbinding into symbol table generation techniques and as such can increasethe utility of symbol tables as tools of facilitating programming and/orsoftware development practice. Nevertheless, the aforementionedadvantages are not required to be present in all of the embodiments ofthe invention and may not be present in all of the embodiments of theinvention.

FIG. 5 is a block diagram depicting components of a computer 500suitable for executing the comprehensive symbol table generationprogram. FIG. 5 displays the computer 500, the one or more processor(s)504 (including one or more computer processors), the communicationsfabric 502, the memory 506, the RAM, the cache 516, the persistentstorage 508, the communications unit 510, the I/O interfaces 512, thedisplay 520, and the external devices 518. It should be appreciated thatFIG. 5 provides only an illustration of one embodiment and does notimply any limitations with regard to the environments in which differentembodiments may be implemented. Many modifications to the depictedenvironment may be made.

As depicted, the computer 500 operates over a communications fabric 502,which provides communications between the cache 516, the computerprocessor(s) 504, the memory 506, the persistent storage 508, thecommunications unit 510, and the input/output (I/O) interface(s) 512.The communications fabric 502 may be implemented with any architecturesuitable for passing data and/or control information between theprocessors 504 (e.g. microprocessors, communications processors, andnetwork processors, etc.), the memory 506, the external devices 518, andany other hardware components within a system. For example, thecommunications fabric 502 may be implemented with one or more buses or acrossbar switch.

The memory 506 and persistent storage 508 are computer readable storagemedia. In the depicted embodiment, the memory 506 includes a randomaccess memory (RAM). In general, the memory 506 may include any suitablevolatile or non-volatile implementations of one or more computerreadable storage media. The cache 516 is a fast memory that enhances theperformance of computer processor(s) 504 by holding recently accesseddata, and data near accessed data, from memory 506.

Program instructions for the comprehensive symbol table generationprogram may be stored in the persistent storage 508 or in memory 506, ormore generally, any computer readable storage media, for execution byone or more of the respective computer processors 504 via the cache 516.The persistent storage 508 may include a magnetic hard disk drive.Alternatively, or in addition to a magnetic hard disk drive, thepersistent storage 508 may include, a solid state hard disk drive, asemiconductor storage device, read-only memory (ROM), electronicallyerasable programmable read-only memory (EEPROM), flash memory, or anyother computer readable storage media that is capable of storing programinstructions or digital information.

The media used by the persistent storage 508 may also be removable. Forexample, a removable hard drive may be used for persistent storage 508.Other examples include optical and magnetic disks, thumb drives, andsmart cards that are inserted into a drive for transfer onto anothercomputer readable storage medium that is also part of the persistentstorage 508.

The communications unit 510, in these examples, provides forcommunications with other data processing systems or devices. In theseexamples, the communications unit 510 may include one or more networkinterface cards. The communications unit 510 may provide communicationsthrough the use of either or both physical and wireless communicationslinks. The comprehensive symbol table generation program may bedownloaded to the persistent storage 508 through the communications unit510. In the context of some embodiments of the present invention, thesource of the various input data may be physically remote to thecomputer 500 such that the input data may be received and the outputsimilarly transmitted via the communications unit 510.

The I/O interface(s) 512 allows for input and output of data with otherdevices that may operate in conjunction with the computer 500. Forexample, the I/O interface 512 may provide a connection to the externaldevices 518, which may include a keyboard, keypad, a touch screen,and/or some other suitable input devices. External devices 518 may alsoinclude portable computer readable storage media, for example, thumbdrives, portable optical or magnetic disks, and memory cards. Softwareand data used to practice embodiments of the present invention may bestored on such portable computer readable storage media and may beloaded onto the persistent storage 508 via the I/O interface(s) 512. TheI/O interface(s) 512 may similarly connect to a display 520. The display520 provides a mechanism to display data to a user and may be, forexample, a computer monitor.

The programs described herein are identified based upon the applicationfor which they are implemented in a specific embodiment of theinvention. However, it should be appreciated that any particular programnomenclature herein is used merely for convenience, and thus theinvention should not be limited to use solely in any specificapplication identified and/or implied by such nomenclature.

The present invention may be a system, a method, and/or a computerprogram product at any possible technical detail level of integration.The computer program product may include a computer readable storagemedium (or media) having computer readable program instructions thereonfor causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, configuration data for integrated circuitry, oreither source code or object code written in any combination of one ormore programming languages, including an object oriented programminglanguage such as Smalltalk, C++, or the like, and procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The computer readable program instructions may executeentirely on the user's computer, partly on the user's computer, as astand-alone software package, partly on the user's computer and partlyon a remote computer or entirely on the remote computer or server. Inthe latter scenario, the remote computer may be connected to the user'scomputer through any type of network, including a local area network(LAN) or a wide area network (WAN), or the connection may be made to anexternal computer (for example, through the Internet using an InternetService Provider). In some embodiments, electronic circuitry including,for example, programmable logic circuitry, field-programmable gatearrays (FPGA), or programmable logic arrays (PLA) may execute thecomputer readable program instructions by utilizing state information ofthe computer readable program instructions to personalize the electroniccircuitry, in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the blocks may occur out of theorder noted in the Figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

What is claimed is:
 1. A computer program product, the computer program product comprising one or more computer readable storage medium and program instructions stored on said one or more computer readable storage medium, said program instructions comprising instructions to: identify a primary symbol table, said primary symbol table being associated with a primary PL/I source code file; identify a secondary symbol table, said secondary symbol table being associated with a secondary PL/I source code file; receive a source code association indication, said source code association indication denoting at least one association relationship between said primary PL/I source code file and said secondary PL/I source code file; create a comprehensive symbol table, said comprehensive symbol table comprising contents of said primary symbol table and contents of said secondary symbol table; retrieve said comprehensive symbol table; receive one or more user source code textual inputs from one or more users, said one or more user source code textual inputs being associated with said primary PL/I source code file; use said comprehensive symbol table to generate zero or more auto-completion suggestions that facilitate at least one of creating and editing of said primary PL/I source code file; determine said zero or more auto-completion suggestions based on said one or more user source code textual inputs and said comprehensive symbol table; and display said zero or more auto-completion suggestions to said one or more users in the context of at least one instance of said primary PL/I source code file. 